package com.meida.student.app.user.handler;

import com.meida.common.base.entity.EntityMap;
import com.meida.common.mybatis.interceptor.SaveInterceptor;
import com.meida.common.mybatis.query.CriteriaSave;
import com.meida.common.security.OpenHelper;
import com.meida.module.bus.client.entity.BusTestpaper;
import com.meida.module.bus.client.enums.TestPaperCheckStateEnum;
import org.springframework.stereotype.Component;

/**
 * 试卷保存
 *
 * @author zyf
 */
@Component
public class TestPaperSaveHandler implements SaveInterceptor<BusTestpaper> {

    @Override
    public void prepare(CriteriaSave criteriaSave, EntityMap entityMap, BusTestpaper busTestpaper) {
        Long userId = OpenHelper.getUserId();
        busTestpaper.setUserId(userId);
        busTestpaper.setState(TestPaperCheckStateEnum.waitCheck.getValue());
    }

}
